package com.framework.core.util;


import com.framework.web.common.domain.Constants;

import java.io.InputStream;
import java.util.Properties;

public class Persistence {

	 synchronized static public String loads(String key){
	   InputStream is = Persistence.class.getResourceAsStream("/constant.properties");
	   String value = "";
	   Properties properties = new Properties();
	     try {
	    	 properties.load(is);
	         value = properties.getProperty(key);
	         is.close();
	      }
	      catch (Exception e) {
	         System.err.println("不能读取属性文件. " +
	         "请确保log4j.properties在CLASSPATH指定的路径中");
	      }
	     return value;
	 }
	 public static String getValue(String key) {
		 String value = loads(key);
		 if(value==null){
			 value="";
		 }
		 return value;
	 }
	 
	 public static boolean getBoolen(String key) {
		 boolean value =Boolean.parseBoolean(loads(key));
		 return value;
	 }
	
/*	*//**
	 * @param args
	 *//*
	public static void main(String[] args) {
		System.out.println(Persistence.getValue(Constants.UPLOADFILE));
	}*/
}
